home *** CD-ROM | disk | FTP | other *** search
/ QuickTime 2.0 Developer Kit / QuickTime 2.0 Developer Kit.iso / mac / MAC / Programming Stuff / Interfaces / CIncludes / fcntl.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-11-21  |  4.9 KB  |  171 lines  |  [TEXT/MPS ]

  1. /*
  2.  * FCntl.h -- faccess(), fcntl(), and open() mode flags
  3.  *
  4.  * Portions copyright American Telephone & Telegraph
  5.  * Used with permission, Apple Computer Inc. (1985,1988,1990,1992-1994)
  6.  * All rights reserved.
  7.  *
  8.  * Warning:  This interface is NOT a part of the ANSI C standard.
  9.  *             We do NOT claim to be POSIX compliant.
  10.  *             If you want your code to be portable, don't use this interface.
  11.  */
  12.  
  13. #ifndef __FCNTL__
  14. #define __FCNTL__
  15.  
  16. #ifndef __TYPES__
  17. #include <Types.h>
  18. #endif
  19.  
  20. #ifndef __FILES__
  21. #include <Files.h>
  22. #endif
  23.  
  24. #ifndef __ALIASES__
  25. #include <Aliases.h>
  26. #endif
  27.  
  28. /*
  29.  *    For use by lseek():
  30.  */
  31.  
  32. #ifndef __STDIO__            /* these defns exactly paralled in StdIO.h for fseek() */
  33. #define SEEK_CUR    1
  34. #define SEEK_END    2
  35. #define SEEK_SET    0
  36. #endif
  37.  
  38. /*
  39.  * faccess() commands; for general use
  40.  */
  41.                      /* 'd' => "directory" ops */
  42. #define F_DELETE        (('d'<<8)|0x01)
  43. #define F_RENAME        (('d'<<8)|0x02)
  44.  
  45. /*
  46.  * more faccess() commands; for use only by MPW tools
  47.  */
  48.  
  49. #define F_OPEN             (('d'<<8)|0x00)        /* reserved for operating system use */
  50.                     /* 'e' => "editor" ops */
  51. #define F_GTABINFO         (('e'<<8)|0x00)        /* get tab offset for file */    
  52. #define F_STABINFO         (('e'<<8)|0x01)        /* set     "    "        "    "  */
  53. #define F_GFONTINFO        (('e'<<8)|0x02)        /* get font number and size for file */
  54. #define F_SFONTINFO        (('e'<<8)|0x03)        /* set     "        "    "    "    "    "      */
  55. #define F_GPRINTREC        (('e'<<8)|0x04)        /* get print record for file */
  56. #define F_SPRINTREC        (('e'<<8)|0x05)        /* set     "        "    "    "      */
  57. #define F_GSELINFO         (('e'<<8)|0x06)        /* get selection information for file */
  58. #define F_SSELINFO         (('e'<<8)|0x07)        /* set        "        "        "        " */
  59. #define F_GWININFO         (('e'<<8)|0x08)        /* get current window position */
  60. #define F_SWININFO         (('e'<<8)|0x09)        /* set    "        "        "        */
  61. #define F_GSCROLLINFO    (('e'<<8)|0x0A)        /* get scroll information */
  62. #define F_SSCROLLINFO    (('e'<<8)|0x0B)        /* set    "           "        */
  63. #define F_GMARKER        (('e'<<8)|0x0D)        /* Get Marker */
  64. #define F_SMARKER        (('e'<<8)|0x0C)        /* Set   "       */
  65. #define F_GSAVEONCLOSE    (('e'<<8)|0x0F)        /* Get Save on close */
  66. #define F_SSAVEONCLOSE    (('e'<<8)|0x0E)        /* Set   "     "     "      */
  67.  
  68. /*
  69.  *    argument structure for use with F_SMARKER command
  70.  */
  71. #ifdef powerc
  72. #pragma options align=mac68k
  73. #endif
  74. struct MarkElement {
  75.     int                start;            /* start position of mark */
  76.     int                end;            /* end position */
  77.     unsigned char    charCount;        /* number of chars in mark name */
  78.     char            name[64];        /* marker name */
  79. };                                    /* note: marker may be up to 64 chars long */
  80.  
  81. #ifdef powerc
  82. #pragma options align=reset
  83. #endif
  84.  
  85. #ifndef __cplusplus
  86. typedef struct MarkElement MarkElement;
  87. #endif
  88.  
  89. #ifdef powerc
  90. #pragma options align=mac68k
  91. #endif
  92. struct SelectionRecord {
  93.     long    startingPos;
  94.     long    endingPos;
  95.     long    displayTop;
  96. };
  97. #ifdef powerc
  98. #pragma options align=reset
  99. #endif
  100. #ifndef __cplusplus
  101. typedef struct SelectionRecord SelectionRecord;
  102. #endif
  103.  
  104. /*
  105.  * Mode values accessible to open()
  106.  */
  107.  
  108. #define O_RDONLY         0         /* Bits 0 and 1 are used internally */
  109. #define O_WRONLY         1         /* Values 0..2 are historical */
  110. #define O_RDWR              2        /* NOTE: it goes 0, 1, 2, *!* 8, 16, 32, ... */
  111. #define O_APPEND    (1<< 3)        /* append (writes guaranteed at the end) */
  112. #define O_RSRC         (1<< 4)        /* Open the resource fork */
  113. #define O_ALIAS        (1<< 5)        /* Open alias file */
  114. #define O_CREAT        (1<< 8)        /* Open with file create */
  115. #define O_TRUNC        (1<< 9)        /* Open with truncation */
  116. #define O_EXCL         (1<<10)     /* w/ O_CREAT:  Exclusive "create-only" */
  117. #define O_BINARY    (1<<11)     /* Open as a binary stream */
  118. #define O_NRESOLVE    (1<<14)        /* Don't resolve any aliases */
  119.  
  120. /*
  121.  * fcntl() commands
  122.  */
  123. #define F_DUPFD 0       /* Duplicate files (file descriptor) */
  124.  
  125. #ifdef __cplusplus
  126. extern "C" {
  127. #endif
  128.  
  129. /*
  130.  *        function prototypes
  131.  */
  132.  
  133. #ifdef __CFM68K__
  134.     #ifdef UsingSharedLibs
  135.         #pragma lib_export on
  136.     #endif
  137. #endif
  138.  
  139. int  close(int);
  140. int  creat(const char*);
  141. int     dup(int filedes);        /* OBSOLETE: fcntl(filedes, F_DUPFD, 0) is preferred */
  142. int     faccess(char*, unsigned int, long*);
  143. int  fcntl(int, unsigned int, int);
  144. long lseek(int, long, int);
  145. int  open(const char*, int);
  146. int  read(int, char*, unsigned);
  147. int  unlink(char*);
  148. int  write(int, const char*, unsigned);
  149. OSErr ResolveFolderAliases (
  150.     /* Info in  */    short volume, long directory, StringPtr path, Boolean resolveLeafAlias,
  151.     /* Info out */    FSSpec *theSpec, Boolean *isFolder, Boolean *hadAlias, Boolean *leafIsAlias);
  152. OSErr MakeResolvedFSSpec (short volume, long directory, StringPtr path,
  153.                           FSSpec *theSpec, Boolean *isFolder, Boolean *hadAlias,
  154.                           Boolean *leafIsAlias);
  155. OSErr ResolvePath (char *rawPath, char *resolvedPath, Boolean *isFolder, Boolean *hadAlias);
  156. OSErr MakeResolvedPath (short volume, long directory, StringPtr path, Boolean resolveLeafAlias,
  157.                         char *buffer, Boolean *isFolder, Boolean *hadAlias, Boolean *leafIsAlias);
  158. pascal Boolean TrapAvailable (short TrapNumber);
  159.  
  160. #ifdef __CFM68K__
  161.     #ifdef UsingSharedLibs
  162.         #pragma lib_export off
  163.     #endif
  164. #endif
  165.  
  166. #ifdef __cplusplus
  167. }
  168. #endif
  169.  
  170. #endif    /*    __FCNTL__    */
  171.